//归档的控制层

package com.wzy.wzyblog.web;


import com.wzy.wzyblog.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;


@Controller
public class ArchiveShowController {

    @Autowired
    private BlogService blogService;

    @GetMapping("/archives")
    public String archives(Model model) {
//        放入map 年份，blog
        model.addAttribute("archiveMap", blogService.archiveBlog());
//       返回博客总数
        model.addAttribute("blogCount", blogService.countBlog());
        return "archives";
    }



}
